package com.itheima.d3_abstract;

import javax.lang.model.element.NestingKind;

public class Test3 {
    public static void main(String[] args) {
        String type = "ICBC";

        OnlinePay pay = null;
        if("ABC".equals(type)){
            pay = new ABC();
        }else if("ICBC".equals(type)){
            pay = new ICBC();
        }
        pay.pay(100);
    }
}

abstract class OnlinePay{
    public abstract void pay(double money);

}

class ICBC extends OnlinePay{
    @Override
    public void pay(double money){
        System.out.println("工商银行爱存不存");
    }
}

class ABC extends OnlinePay{
    @Override
    public void pay(double money){
        System.out.println("农商银行唉不存");
    }
}


